import Two from "two.js";
import { Path } from "two.js/src/path";
import { Anchor } from "two.js/src/anchor";

export class TwoHelper {
  private two: Two;

  constructor(two: Two) {
    this.two = two;
  }

  // 构建三角形
  public makeTriangle(size: number): Path {
    return this.two.makePath([
      new Anchor(-size / 2, 0),
      new Anchor(size / 2, 0),
      new Anchor(0, size),
    ]);
  }

  /**
   * 度 换算 弧度
   * @param degree
   */
  public getRadian(degree: number) {
    return (degree / 180) * Math.PI;
  }
}
